﻿using System;
using System.Windows;

namespace Tiny.Imaging.Filter.PointFilter
{
    public class ExposureFilter : CurvesFilter
    {
        public ExposureFilter(int factor)
        {
            Channel = RgbChannel.Rgb;

            Point ctrl1;
            Point ctrl2;
            double p = Math.Abs(factor)/100.0;
            if (factor < 0)
            {
                ctrl1 = new Point((255*p), 0);
                ctrl2 = new Point(255, (255 - (255*p)));
            }
            else
            {
                ctrl1 = new Point(0, (255*p));
                ctrl2 = new Point((255 - (255*p)), 255);
            }

            Bezier = PrepopulateBezier(new Point(0, 0), ctrl1, ctrl2, new Point(255, 255));
        }
    }
}